<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8" />
		<title>${title}</title>
		<script type="text/javascript">
			var checkTimes=0;
			function log(logContent){
				//console.log(logContent);
			}
			function getIframeControlValue(iframeId){
				try{
					var iHtml = document.getElementById(iframeId).contentWindow.document.body.inneHTML;
					log("iHtml:"+iHtml);
					if (iHtml!=null && iHtml!="")
					{
						log("check iframe successfully:"+ofrm);
						return "ok";
					}
					else
					{
						log("check iframe failed.");
						checkTimes++;
					}
				}catch(e){
					log("get iframe body exeption happened:"+e);
					return "ok";
				}		  
			}
			function fnLoadOk(){
			  var b = true;
			  for(var i=1;i<=1;i++){
				if (getIframeControlValue("frame" + i)=="ok"){
				  b = b && true;
				}
				else
				{
				  b = b && false;
				}
			  }
			  return b;
			}
			var _check = null;
			function t(){
			  if (fnLoadOk()){
				clearInterval(_check);
				removeElement(document.getElementById("directUrl"));
			  }else if(checkTimes>=5){
				log("load iframe fail");
				clearInterval(_check);
				window.location="${url}";
			  }
			}
			function removeElement(_element){
				var _parentElement = _element.parentNode;
				if(_parentElement){
				       _parentElement.removeChild(_element);
				}
			}
			_check = setInterval("t()",1000);
			
		</script>
	</head>
	<body style="margin:0px">
		<div>
			<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
				<!-- NavigatorJump -->
				<ins class="adsbygoogle"
				     style="display:block"
				     data-ad-client="ca-pub-adsensepubid"
				     data-ad-slot="2971535400"
				     data-ad-format="auto"></ins>
				<script>
				(adsbygoogle = window.adsbygoogle || []).push({});
			</script>
		</div>
		<div id="directUrl"><a href="${url}">Page is loading. Visit ${title} directly.</a></div>
		<iframe name="frame1" id="frame1" style="width:100%;height:1100px;" frameborder=0  marginheight=0 marginwidth=0 src="${url}"></iframe>
	</body>
</html>
